package com.visizen.wisdomclass.server.client;

import com.visizen.wisdomclass.server.model.WcTerm;
import com.visizen.wisdomclass.server.model.WcTermExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface WcTermMapper {
    @SelectProvider(type=WcTermSqlProvider.class, method="countByExample")
    int countByExample(WcTermExample example);

    @DeleteProvider(type=WcTermSqlProvider.class, method="deleteByExample")
    int deleteByExample(WcTermExample example);

    @Delete({
        "delete from wc_term",
        "where ID = #{ID,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long ID);

    @Insert({
        "insert into wc_term (ID, TERM_ID, ",
        "GROUP_ID, TERM_NAME, ",
        "BEGIN_TIME, END_TIME)",
        "values (#{ID,jdbcType=BIGINT}, #{TERM_ID,jdbcType=BIGINT}, ",
        "#{GROUP_ID,jdbcType=BIGINT}, #{TERM_NAME,jdbcType=VARCHAR}, ",
        "#{BEGIN_TIME,jdbcType=DATE}, #{END_TIME,jdbcType=DATE})"
    })
    int insert(WcTerm record);

    @InsertProvider(type=WcTermSqlProvider.class, method="insertSelective")
    int insertSelective(WcTerm record);

    @SelectProvider(type=WcTermSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ID", property="ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="TERM_ID", property="TERM_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="GROUP_ID", property="GROUP_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="TERM_NAME", property="TERM_NAME", jdbcType=JdbcType.VARCHAR),
        @Result(column="BEGIN_TIME", property="BEGIN_TIME", jdbcType=JdbcType.DATE),
        @Result(column="END_TIME", property="END_TIME", jdbcType=JdbcType.DATE)
    })
    List<WcTerm> selectByExample(WcTermExample example);

    @Select({
        "select",
        "ID, TERM_ID, GROUP_ID, TERM_NAME, BEGIN_TIME, END_TIME",
        "from wc_term",
        "where ID = #{ID,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="ID", property="ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="TERM_ID", property="TERM_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="GROUP_ID", property="GROUP_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="TERM_NAME", property="TERM_NAME", jdbcType=JdbcType.VARCHAR),
        @Result(column="BEGIN_TIME", property="BEGIN_TIME", jdbcType=JdbcType.DATE),
        @Result(column="END_TIME", property="END_TIME", jdbcType=JdbcType.DATE)
    })
    WcTerm selectByPrimaryKey(Long ID);

    @UpdateProvider(type=WcTermSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") WcTerm record, @Param("example") WcTermExample example);

    @UpdateProvider(type=WcTermSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") WcTerm record, @Param("example") WcTermExample example);

    @UpdateProvider(type=WcTermSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(WcTerm record);

    @Update({
        "update wc_term",
        "set TERM_ID = #{TERM_ID,jdbcType=BIGINT},",
          "GROUP_ID = #{GROUP_ID,jdbcType=BIGINT},",
          "TERM_NAME = #{TERM_NAME,jdbcType=VARCHAR},",
          "BEGIN_TIME = #{BEGIN_TIME,jdbcType=DATE},",
          "END_TIME = #{END_TIME,jdbcType=DATE}",
        "where ID = #{ID,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(WcTerm record);
}